﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using CloverNet.Authorization;

namespace CloverNet.Authorization.Demo
{
    public class AuthorizationConfig
    {
        public static void Initialization() {

            //获取用户权限
            DefaultPermissionProvider.Current = new LoginPermissionProvider();
            
            //设置无权访问重定向地址
            AuthorizationManager.UnAuthenticationAction = (httpContext) =>
            {
                return new RedirectResult("/Account/LogIn?refer=" + HttpUtility.UrlEncode(httpContext.Request.Url.ToString()));
            };
        }
}
}